//
//  DongtaiView.m
//  UI_Homework_09
//
//  Created by 黄威 on 16/5/14.
//  Copyright © 2016年 黄威. All rights reserved.
//

#import "DongtaiView.h"
#import "DongtaiShowView.h"

@interface DongtaiView ()

@end

@implementation DongtaiView

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    [self config];
    
    [self createImage];
    
}

- (void)config{


self.navigationItem.title = @"动态相册";

}


- (void)createImage{

    UIScrollView *scrollphoto = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds))];
    
    scrollphoto.contentSize = CGSizeMake(CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds) * 4) ;
    
    [self.view addSubview:scrollphoto];
    
    self.mArr = [[NSMutableArray alloc]init];
    
        
        for (int j = 0 ; j < 10 ; j++) {
            
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = CGRectMake(0, (170* j), 375, 150);
            NSString *str = [NSString stringWithFormat:@"%d.jpg",(j + 1)];
            
            
            UIImage *image = [UIImage imageNamed:str];
            
            [button setImage:image forState:UIControlStateNormal];
            [scrollphoto addSubview:button];
            [self.mArr addObject:image];
            
            
            [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
            button.tag = (j + 1) ;
            
            NSLog(@"%d",(j + 1)) ;
            
        
       
    }
}


- (void)buttonAction:(UIButton *)button{
    
    DongtaiShowView *showView = [[DongtaiShowView alloc]init];
    
    showView.number = button.tag;
    
    [self.navigationController pushViewController:showView animated:YES];
    
    
    }





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
